/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.seminariosab.tools;

import com.sybase.jdbc4.jdbc.SybConnection;
import com.sybase.jdbc4.jdbc.SybDriver;
import java.sql.DriverManager;

/**
 *
 * @author Administrador
 */
public class SABCnxSyb {

    SybConnection cnx_m = null;
    private SybConnection cnx_mm=null;

    public SABCnxSyb() {
        String unam = "", pname = "", URL = "", URL2="";
        try {
            SybDriver sybDriver = (SybDriver) Class.forName("com.sybase.jdbc4.jdbc.SybDriver").newInstance();
            //sybDriver.setVersion(com.sybase.jdbcx.SybDriver.VERSION_LATEST);
            DriverManager.registerDriver(sybDriver);
            URL="jdbc:sybase:Tds:192.168.22.7:2638";
            URL2 = "jdbc:sybase:Tds:192.168.21.100:2638";
            cnx_m = (SybConnection) DriverManager.getConnection(URL, "dba", "SEMINARIO");
            cnx_mm = (SybConnection) DriverManager.getConnection(URL2, "dba", "SEMINARIO");
            
        } catch (Exception ex) {
            System.out.println("" + SABCnxSyb.class.getName() + " - " + ex.toString());
        }
    }

    public SybConnection getSybCnx(int bdindex) {
        return ((bdindex==0)? cnx_m: cnx_mm);
        
    }

    public String[] getCredentials() {
        return null;
    }
}


/**
 * 
 Properties sysProps = System.getProperties();
String drivers = "com.sybase.jdbc3.jdbc.SybDriver";
String oldDrivers =
sysProps.getProperty("jdbc.drivers");
if (oldDrivers != null)
   drivers += ":" + oldDrivers;
 sysProps.put("jdbc.drivers", drivers.toString());
 * 
 * */